from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
import pandas as pd

toy_corpus = ['the fat cat sta on the mat',
              'the big cat slept',
              'the dog chased a cat'
              ]
vectorizer = TfidfVectorizer()
corpus_tfidf = vectorizer.fit_transform(toy_corpus)
print("the vocabulary size is {}".format(len(vectorizer.vocabulary_.keys())))
df = pd.DataFrame(np.round(corpus_tfidf.toarray(),2))
print(df)

from sklearn.pipeline import make_pipeline
from sklearn.svm import SVC
labels= [1,0,1]
clf =  SVC()
clf.fit(df, labels)

print(clf.predict(df))